package com.cskaoyan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 请求头限定
 */
@Controller
public class HeaderLimitController {

    @RequestMapping(value = "header/limit",headers = {"Accept","aaa"})
    @ResponseBody
    public String headerLimit() {
        return "header limit";
    }

    //如果响应Json的话，如果要做Accept限定，要包含application/json
    @RequestMapping(value = "accept", produces = "application/json")
    @ResponseBody
    public String acccept() {
        return "accept";
    }
    //如果接收Json的话，如果要做ContentType限定，要包含application/json
    //当前这个handler方法没有接收Json参数
    @RequestMapping(value = "content/type", consumes = "ccc/ddd")
    @ResponseBody
    public String contentType() {
        return "contentType";
    }
}
